<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script src="${pageContext.request.contextPath}/js/jquery-1.9.1.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/themes/default/easyui.css">   
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/themes/icon.css">   
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script> 
<style type="text/css">
body {
	min-width: 550px;
}
#middle {
	top:10px;
}
#middle_search{
	margin-top: 20px;
}
#search {
	text-align: right;
}
#tb{
	margin-top: 20px;
}
</style>
<script type="text/javascript">
$(function(){
	//加载页面时判断当前用户是否为考勤部，若是，则显示搜索框
	$.ajax({
		url:'${pageContext.request.contextPath}/isAttendanceDept',
		type:'post',
		data:1,
		dataType:'text',
		success:function(data){
			if ("0" == data) {
				$("#middle_search").hide();
			}
		}
	});
	//加载当前员工的缺勤列表
	$("#showCurrentEmployeeAbsent").datagrid({    
	    url:'${pageContext.request.contextPath}/getCurrentEmployeeAbsent',
	    pagination:true,
	    width:'100%',
	    columns:[[    
	        {field:'e_number',title:'员工号',align:'center',width:'15%'},    
	        {field:'e_name',title:'姓名',align:'center',width:'15%'},
	        {field:'absent_starttime',title:'开始时间',align:'center',width:'35%'},
	        {field:'absent_endtime',title:'结束时间',align:'center',width:'35%'}
	    ]],
	});
});
	//显示搜索到的员工的缺勤信息
	function qq(value,name){
		$("#showCurrentEmployeeAbsent").datagrid({    
		    url:'${pageContext.request.contextPath}/searchEmployeeAbsent',
		    pagination:true,
		    width:'100%',
		    queryParams:{
		    	searchType:name,
		    	searchContent:value
		    },
		    columns:[[    
		        {field:'e_number',title:'员工号',align:'center',width:'15%'},    
		        {field:'e_name',title:'姓名',align:'center',width:'15%'},
		        {field:'absent_starttime',title:'开始时间',align:'center',width:'35%'},
		        {field:'absent_endtime',title:'结束时间',align:'center',width:'35%'}
		    ]],
		});
	}
</script>
</head>
<body>
	<div class="container-fluid">
		<div class="rows">
			<div class="col-md-12" id="middle">
				<!-- 搜索框 -->
				<div class="rows" id="middle_search">
					<div class="col-md-12">
						<div id="search">
							<input id="ss" class="easyui-searchbox" style="width:300px;" 
							data-options="searcher:qq,prompt:'请输入查询内容',menu:'#mm'"></input> 
							<div id="mm" style="width:120px"> 
								<div data-options="name:'员工编号',iconCls:'icon-ok'">按员工编号</div> 
								<div data-options="name:'员工姓名'">按员工姓名</div> 
								<div data-options="name:'查找所有'">按查找所有</div> 
							</div> 
						</div>
					</div>
				</div>
				<!-- 表格 -->
				<div class="rows" id="middle_table">
					<div class="col-md-12" id="tb">
						<table id="showCurrentEmployeeAbsent"></table>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>